package _6_Struct._6_6_flyweight.composite;

/*
与合成模式结合，复合对象分解成单纯对象，单纯对象共享
 */
public class Client {
    private static FlyweightFactory factory;

    public static void main(String[] args) {
        factory = new FlyweightFactory();

        Flyweight fly;
/*        fly = factory.factory(new Character('a'));
        fly.operation();
		
		fly = factory.factory(new Character('b'));
		fly.operation();
		
		fly = factory.factory(new Character('a'));
		fly.operation();
*/
//        fly = factory.factory("abc");
        ConcreteCompositeFlyweight compositeFly = new ConcreteCompositeFlyweight();
        fly = factory.factory("abcdc");
        fly.operation("Composite Call");
        fly = factory.factory("ccccc");
        fly.operation("Composite Call");

// intrinsic Flyweight
        factory.checkFlyweight();
    }
}
